home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / handson / supercede / Knowodys / Projects / mq_projects.exe / MindQ_Projects / Syntax / Primes / hoePrimes.txt next >
Encoding:
Text File  |  1997-08-13  |  1.1 KB  |  28 lines

  1. Launch a Java development environment from your desktop 
  2. or select it from the task bar if it is already running. 
  3. Then follow the instructions below.  
  4.  
  5. Step 1:  Create an applet named Primes. Primes will be 
  6. passed an integer parameter from the HTML file that 
  7. indicates the highest number for which to check for prime 
  8. numbers. Write the init() method that will retrieve this 
  9. value into an integer variable high.
  10.  
  11. Step 2:  Write a paint() method that will use nested 
  12. loops. The outer loop will repeat while incrementing 
  13. theNum from 1 to high. The inner will check each number 
  14. to find out if it is prime. Remember that a number is 
  15. prime if and only if it is only divisible by itself and 
  16. 1. Do not use any break or continue statements in your 
  17. program.
  18.  
  19. Step 3: Print each prime number to the applet window.
  20.  
  21. Step 4: Compile your applet, write an HTML file that will 
  22. embed it in a web page, then load the applet in a web 
  23. browser or applet viewer.
  24.  
  25. Step 5: Now change the applet to include a continue 
  26. statement or labeled break statement. 
  27.  
  28. Step 6: Compile and run your new applet.